package com.gxa.order.controller;

import com.gxa.order.util.PayUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;

@RestController
public class PayController {
    /**
     * 支付接口
     * @param No
     * @param money
     * @param name
     * @param response
     */
    @RequestMapping("/pay")
    public void pay(String No, String money, String name, HttpServletResponse response){
        PayUtil.od(No,money,name,response);
    }

    /**
     * 退款接口
     * @param num
     * @param response
     */
    @RequestMapping("/refund")
    public void refund(String num, BigDecimal money,HttpServletResponse response){
        String select = PayUtil.select(num);
        PayUtil.refund(select,money,response);
    }

    /**
     * 退款是否成功查询
     * @param num
     * @param response
     */
    @RequestMapping("/select")
    public void select(String num,HttpServletResponse response){
        String select = PayUtil.select(num);
        PayUtil.selectrefund(select,response);
    }

}
